package Thread;

//4.匿名内部类实现Runnable
public class Test04 {
    static int count;

    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true){
                    System.out.println(count++);
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        thread.start();
        while (true){
            System.out.println("我是main线程");
            Thread.sleep(1000);
        }
    }


}
